<template>
  <el-table :data="tableData" style="width: 100%">
    <el-table-column prop="certificateSpeciality" label="专业名称" min-width="150" />
    <el-table-column prop="skillLevel" label="资格名称、职称等级" min-width="180" />
    <el-table-column prop="reviewOrganization" label="评审组织" min-width="120" />
    <el-table-column prop="issuingAuthority" label="审批机关" min-width="120" />
    <el-table-column prop="certificateNo" label="批准文号" min-width="120" />
    <el-table-column prop="issueDate" label="批准时间" min-width="120" />
    <el-table-column prop="holder" label="持有人" min-width="120" />
    <el-table-column prop="attachments" label="证书附件" min-width="120">
      <template #default="scope">
        <el-text v-for="item in scope.row.attachments" :key="item.attachmentId" class="mx-1">{{
          item.attachmentName
        }}</el-text>
      </template>
    </el-table-column>
    <el-table-column v-if="optionType != 3" fixed="right" label="操作" width="120">
      <template #default>
        <el-button link type="primary" size="small" @click="handleDelet">删除</el-button>
      </template>
    </el-table-column>
  </el-table>
</template>

<script setup lang="ts">
const props = defineProps({
  tableData: {
    type: Array as PropType<any[]>,
    default: () => [],
  },
  optionType: {
    type: Number,
    default: 1,
  },
});
const { tableData, optionType } = toRefs(props);
const emit = defineEmits(["deleteRow"]);
function handleDelet(row: any, index: number) {
  emit("deleteRow", 4, index);
}
</script>

<style scoped></style>
